package com.kgc.polym.demo1;

import java.text.MessageFormat;

public class Dog extends Pet{
    private String strain;//品种

    public Dog() {

    }

    public Dog(String nickName, int health, int love, int liveness, String strain) {
        super(nickName, health, love, liveness);
        this.setStrain(strain);
    }

    public String getStrain() {
        return strain;
    }

    public void setStrain(String strain) {
        this.strain = strain;
    }

    /**
     * 重写父类显示宠物详细信息方法
     */
    @Override
    public void showDetails() {
        String message = MessageFormat.format
            ("宠物的自白:\n我的名字叫{0},我的健康值是{1},我和主人的亲密度是{2}，活跃度是{3}，我是一只{4}犬",
                    super.getNickName(),super.getHealth(),super.getLove(),super.getLiveness(),this.getStrain());
        System.out.println(message);
    }
}
